home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.3 / Video Toaster v4.3.iso / 4.2 / arexx / editor / oz / 31-grp-vols < prev    next >
Text File  |  1998-04-16  |  6KB  |  175 lines

  1. /* Audio-Lvls.rexx V1.3 -- Changes the audio volumes of a project in many ways, Absolute, Proportional or Relative.  Try Proportional - it maintains your mixing balance by adjusting by percentages.
  2.  
  3. -- By Aussie -  ©1995 Michael Holten      
  4.  
  5.  
  6. This routine allows a variety of methods to select the clips you wish to affect. (e.g. Video or audio clips, channel assignment, and audio ON or OFF)
  7.  
  8. Note: This routine operates only on clips starting at the highlighted one through to either a STOP crouton or the end of project.  Place a STOP crouton (found in Effects/Control folder) into your project, if you wish to limit this routine. 
  9. */
  10.  
  11. call remlib('PROJECT_REXX_PORT')
  12. call addlib('PROJECT_REXX_PORT',0)
  13.  
  14. start_loc=croutonspot()
  15. project_end=croutonsinproject()
  16. call croutonpick(start_loc)
  17.  
  18. current_spot=start_loc  /*was 0 */
  19. highvol=100
  20. progsign=" "
  21.  
  22. /* --- wait for any screen update delay --- */
  23. call time('R')
  24. do while (time('E')<0.5)
  25.     end
  26.  
  27. call req_open("Group Levels - by Aussie","------------------------","Controls audio volumes in many ways.","From SELECTED icon to END (or STOP icon)")
  28. test=req_tell("First you pick your mixing style"," "," ")
  29. call req_close()
  30. if test~=1 then call quit()
  31.  
  32. call req_open("Audio Levels - by Aussie","1:Absolute (force levels to = setting)","2:Proportional (adjust by % value)    ","3:Relative (adjust by +/- value)       ")
  33. prog=req_number("1:Abs(=)  2:Prop(%)  3:Relat(+/-)",2,1,3)
  34. call req_close()
  35. if prog="CANCEL" then call quit()
  36. if prog=1 then call progabs()
  37. if prog=2 then call progprop()
  38. if prog=3 then call progrel()
  39. if volume="CANCEL" then call quit()
  40.  
  41. test=req_buttons("Now pick which clips to control...","11","Audio clips","Video clips")
  42. if test="CANCEL" | test="00" then call quit()
  43. if test="01" then cp=1
  44. if test="10" then cp=2
  45. if test="11" then cp=3
  46.  
  47. if cp=1 then note1="Video clips only"
  48. if cp=2 then note1="Audio clips only"
  49. if cp=3 then note1="Both Video & Audio clips"
  50.  
  51.  
  52. test=req_buttons("Select clips set ONLY as...","1110","Channel 1 (Mono)","Channel 2 (Mono)", "Ch 1+2 (Stereo)","Audio turned OFF")
  53. if test="CANCEL" | test="0000" then call quit()
  54. ch1=substr(test,1,1)
  55. ch2=substr(test,2,1)
  56. ch3=substr(test,3,1)
  57. ch4=substr(test,4,1)
  58.  
  59.  
  60. if ch1=1 then note2="Left channel clips only"
  61. if ch2=1 then note2="Right channel clips only"
  62. if ch3=1 then note2="Stereo clips only"
  63. if ch4=1 then note2="Audio OFF clips only"
  64.  
  65. if ch1+ch2+ch3+ch4>1 then do
  66.    note2=""
  67.    if ch1 then note2="Left "
  68.    if ch2 then note2=note2||"Right "
  69.    if ch3 then note2=note2||"Stereo "
  70.    if ch4 then note2=note2||"Audio OFF"
  71.    if ch1 & ch2 & ch3 & ch4 then note2="All clips"
  72.    end
  73. call req_open(,,"Proceed with settings?","This is last chance to proceed or cancel.")
  74. test=req_tell("Proceed with changing audio levels",prognote volume progsign,"Clips: " note1,"Select: " note2)
  75. call req_close()
  76. if test=0 then call quit()
  77.  
  78. current_spot=start_loc /* was 0 */
  79.  
  80. do while (current_spot<project_end+1)
  81.    call croutonpick(current_spot)
  82.    current_spot=current_spot+1
  83.  
  84.  
  85.    if croutontype()="CTRL" then do
  86.       test=croutonname()
  87.       test1=right(test,length(test)-lastpos("/",test))
  88.       test3=("STOP" = upper(test1))
  89.       if test3=1 then do
  90.          call croutonpick(start_loc)
  91.          call req_error(" OZ:  All Done, Stopping at STOP crouton      <<< New audio volumes set >>>")
  92.          call quit2()
  93.          end
  94.       end
  95.  
  96.  
  97.  
  98.    if ((cp=1 | cp=3) & croutontype()="CLIP") | (cp>1 & croutontype()=" AUD") then do
  99.       test=croutongettag(AUDIOON)
  100.       if (ch4 & test<7) | (ch3 & test=15) | (ch2 & test=11) | (ch1 & test=7) then do
  101.          vol1M=croutongettag(AUDIOVOLUME1)
  102.          vol1=((vol1M/655.35)+0.5)%1
  103.          if prog=1 then vol1=volume
  104.          if prog=2 then vol1=(vol1*volume)/100
  105.          if prog=3 then vol1=vol1+volume
  106.          if vol1<0 then vol1=0
  107.          if vol1>100 then vol1=100
  108.          vol1=vol1*655.35
  109.          call croutonsettag(AUDIOVOLUME1,vol1)
  110.          vol2M=croutongettag(AUDIOVOLUME2)
  111.          vol2=((vol2M/655.35)+0.5)%1
  112.          if prog=1 then vol2=volume
  113.          if prog=2 then vol2=(vol2*volume)/100
  114.          if prog=3 then vol2=vol2+volume
  115.          if vol2<0 then vol2=0
  116.          if vol2>100 then vol2=100
  117.          vol2=vol2*655.35
  118.          call croutonsettag(AUDIOVOLUME2,vol2)
  119.          end
  120.       end
  121.    end
  122.  
  123. call croutonpick(start_loc)
  124. call req_error(" OZ:   All Done!     <<< New audio volumes are set >>>")
  125. call remlib("PROJECT_REXX_PORT")
  126. exit
  127.  
  128.  
  129. progabs:
  130. prognote="Absolute level:  ="
  131. call req_open("Absolute Volume (=)","---------------------------","This routine will change all volumes","absolutely
  132.  to equal the above level.")
  133.  
  134. volume=req_number("Make all volumes (0-100):",70,0,100)
  135. call req_close()
  136. return
  137.  
  138.  
  139. progprop:
  140. prognote="Percentage adjustment:  "
  141. call req_open("Proportional Volume (%)","-------------------------------","This routine will change all volumes","proportionally
  142.  by the above percentage.")
  143.  
  144. progsign="%"
  145. volume=req_number("Make 100% volume (0-1000):",highvol,0,1000)
  146. call req_close()
  147. if volume=100 then do
  148.    call req_tell("<<< Canceled >>>","     Because % was set to 100%","     No
  149.  levels would be changed.")
  150.    call quit()
  151.    end
  152. return
  153.  
  154.  
  155. progrel:
  156. prognote="Relative adjustment:  "
  157. call req_open("Relative Volume (+/-)","---------------------------","This routine will change all volumes relatively","
  158. by adding or subtracting the above value")
  159.  
  160. volume=req_number("Adjust volumes by (-100 to +100):",0,-100,100)
  161. call req_close()
  162. if volume>0 then prognote=prognote||"+"
  163. if volume=0 then call quit()
  164. return
  165.  
  166.  
  167. quit:
  168. call croutonpick(start_loc)
  169. call req_error(" OZ:     <<< Last Operation Canceled >>>")
  170.  
  171. quit2:
  172. call remlib("PROJECT_REXX_PORT")
  173.  
  174. exit
  175.